<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>酒店信息系统</title>
<LINK rel=stylesheet href="__PUBLIC__/css/style.css">
<link type="text/css" rel="stylesheet" href="__PUBLIC__/css/page.css" />
<script src="__PUBLIC__/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script language="javascript">

function checkallstu(o) {
	if(o.checked){
		$("input[name='contentbox']").attr("checked",true);
	}else{
		$("input[name='contentbox']").attr("checked",false);
	}
}

function addip(){
	var ip_name= $("#ip_name").val();
	var ip_address= $("#ip_address").val();
	var ip_status= $("#ip_status").val();
    var netcard_num= $("#netcard_num").val();


	if(ip_name==''){
		alert('请填写ip名称');
		return false;
	}
	if(ip_address==''){
		alert('请填写ip地址');
		return false;
	}

	$.post("__APP__/system/addip",{
			ip_address: ip_address,
			ip_name: ip_name,
			ip_status:ip_status,
           	netcard_num:netcard_num, 
	}, function(data) {
		if(data.msg=="1"){
			alert("添加成功");
			location.reload();
		}else{
			alert("添加失败");
		}
	},"json");
}
function addApk(){
	$("#addApk").show().css("position", "fixed").css("margin-top","200px").css("margin-left","500px");
}


function editapk(){
	var id = $("#id").val();
	var eip_address = $("#eip_address").val();
	var eip_name= $("#eip_name").val();
	var enetcard_num= $("#enetcard_num").val();
    var eip_status= $("#eip_status").val();

		$.post("__APP__/system/editip",{
			id: id,
			ip_address: eip_address,
			ip_name: eip_name,
			ip_status:eip_status,
           	netcard_num:enetcard_num, 
		}, function(data) {
			if(data.msg=="1"){
				alert("编辑成功");
				location.reload();
			}else{
				alert("编辑失败");
			}
		},"json");
	
	
}
function edit(id,ip_name,ip_address,netcard_num, ip_status){
	
		$("#edit").show();
		$("#eip_name").val(ip_name);
		$("#eip_address").val(ip_address);
		$("#enetcard_num").val(netcard_num);
        $("#eip_status").val(ip_status);
		$("#id").val(id);
	
}

function delall(){
    var arr="";
    $("input[name=contentbox]:checked").each(function(){
    	arr+=$(this).val()+",";
    })
    if(arr==""){
    	alert('请选择要删除的记录');
		return false; 
    }
    if (!confirm("您确定要删除吗？")){
        return false;
    }
    	
    $.post("__APP__/system/delallip",{
    	arr : arr
	}, function(data) {
		if(data.msg=="1"){
			alert("删除成功");
			location.reload();
		}else{
			alert("删除失败");
		}
	},"json");
}

</script>
</head>

<body>
<input type="hidden" id="id" name="id"></td>
{include file="public/head"} 
 <div class="content_TX"><img src="__PUBLIC__/images/touxiang.png"></div>
</div>
<div class="content_2 clear">
{include file="system/left"}
<div class="content_3 left">
  <div class="content_3_wz"><img src="__PUBLIC__/images/dajt.png" />系统维护 &gt; 升级管理</div>

  <table width="100%" border="0" cellpadding="0" class="content_bg">
   <thead >
      <tr>
        <td width="51" >选择</td>
		<td width="10%" >编号</td>
     
        <td width="24%" >ip名字</td>
        <td width="23%" >ip地址</td>
		<td width="23%" >网卡数</td>
        <td width="12%" >ip状态</td>
        <td width="12%" >操作</td>
      </tr>
    </thead>
    <tbody>
      <?php
      if($row){
      foreach($row as $val){ 
      ?>
      <tr  >
	   <td><input  type="checkbox" name="contentbox" id="contentbox"  value="{$val[id]}"></td>
        <td>{$val[id]}</td>
    
        <td>{$val[ip_name]}</td>
        <td>{$val[ip_address]}</td>
		<td>{$val[netcard_num]}</td>
        <td>{$val[ip_status]}</td>
        <td><a href="#" class="layui-btn layui-btn-sm"onclick="edit('{$val[id]}','{$val[ip_name]}','{$val[ip_address]}','{$val[netcard_num]}','{$val[ip_status]}')">修改</a></td>
      </tr>
      <?php
      }
       } 
      ?>
    </tbody>
  </table>
  
   <div class="content_1234">
    <div class="content_glcz">管理操作：全选
	      <input name="checkbox" type="checkbox" onClick="checkallstu(this)" />
	        <input name="submit" type="button" value="删除" onclick="delall()"  class="layui-btn layui-btn-sm layui-btn-warm"/>
	      <input name="submit2" type="button" value="添加ip " onclick="addApk()" class="layui-btn layui-btn-sm"/>
      </div>
     <div class="layui-box layui-laypage layui-laypage-default">{$page}</div>
  </div>
  
<div id="edit" style="DISPLAY:none" class="show">
  <table width="500px" border="0" align="center"  cellpadding="0" bgcolor="#FFFFFF" style="text-align:center; border:1px solid #e4e4e4;">
   <thead >
      <tr>
        <td colspan="2">ip管理<input type="hidden" id="id" name="id"></td>
      </tr>
    </thead>
    <tbody>
      <tr class="ctt_gr">
        <td align="right">ip名字 ：</td>
        <td align="left"><input class="textField_hp1" size="25" type="text" id="eip_name" /></td>
      </tr>
      <tr class="ctt_gr">
        <td align="right">ip地址：</td>
        <td align="left"><input class="textField_hp1" size="25" type="text" id="eip_address" /></td>
      </tr>
	    <tr class="ctt_gr">
        <td align="right">网卡数：</td>
        <td align="left"><input class="textField_hp1" size="25" type="text" id="enetcard_num" /></td>
      </tr>
       <tr class="ctt_gr">
        <td align="right">ip 状态：</td>
        <td align="left"><input class="textField_hp1" size="25" type="text" id="eip_status" /></td>
      </tr>
   
      <tr class="ctt_gr">
        <td colspan="2" align="center"><input name="submit2" type="button" value="确定" border="0"  onClick="editapk()" class="layui-btn"/>
            <input name="submit22" type="submit" value="取消" border="0" method="post"  class="layui-btn layui-btn-warm" onclick="document.getElementById
('edit').style.display='none'"/>
        </td>
      </tr>
    </tbody>
  </table>
</div>
  

<div id="addApk" style="DISPLAY:none" class="show">
	  <table class="layui-table" lay-skin="line">
	   <thead >
	      <tr>
	        <td colspan="2">ip添加</td>
	       
	      </tr>
	    </thead>
	    <tbody>
	     <tr class="ctt_gr">
        <td align="right">ip名字：</td>
        <td align="left"><input class="textField_hp1" size="25" type="text" id="ip_name" /></td>
      </tr>
        <td align="right">ip地址：</td>
        <td align="left"><input class="textField_hp1" size="25" type="text" id="ip_address" /></td>
      </tr>
	    <tr class="ctt_gr">
        <td align="right">网卡数：</td>
        <td align="left"><input class="textField_hp1" size="25" type="text" id="netcard_num" /></td>
      </tr>
       <tr class="ctt_gr">
        <td align="right">ip状态：</td>
        <td align="left"><input class="textField_hp1" size="25" type="text" id="ip_status" /></td>
      </tr>  
	  
	      <tr class="ctt_gr">
	        <td height="31" colspan="2" align="center"><input name="submit22" type="button" value="确定" onclick="addip()" class="layui-btn"/>
	          <input name="submit22" type="button" value="取消" border="0" onclick="document.getElementById
	('addApk').style.display='none'" class="layui-btn layui-btn-warm"/></td>
	        </tr>
	    </tbody>
	  </table>
	</div>
	


    



</div>
</body>
</html>
